s = raw_input()
lines = 0
def cao(s):
	if s == '':
		exit()
	global lines
	n = len(s)
	if n == 1:
		return s
	b = 0
	pos = -1
	sym = ''
	flag = True
	for i in range(n)[::-1]:
		if s[i] == '(':
			b += 1
		elif s[i] == ')':
			b -= 1
		elif b == 0:
			if s[i] == '.':
				flag = False
			if s[i] == '*' or s[i] == '/':
				if sym == '':
					sym = s[i]
					pos = i
			if s[i] == '+' or s[i] == '-':
				if sym == '' or sym == '*' or sym == '/':
					sym = s[i]
					pos = i
	if pos == -1:
		if flag:
			if s[0] == '(':
				return cao(s[1: -1])
			else:
				b = 0
				argu = []
				for i in range(n):
					if s[i] == '(':
						if b == 0:
							u = i + 1
						b += 1
					elif s[i] == ')':
						b -= 1
						if b == 0:
							argu.append(cao(s[u: i]))
					elif b == 1:
						if s[i] == ',':
							argu.append(cao(s[u: i]))
							u = i + 1
				print s[pos+1],
				for i in argu:
					print i,
				print
				lines += 1
				return lines


		for i in range(n)[::-1]:
			if s[i] == '(':
				b += 1
			elif s[i] == ')':
				b -= 1
			elif b == 0:
				if s[i] == '.':
					pos = i
					break
		obj = cao(s[:i])
		b = 0
		argu = []
		for i in range(pos, n):
			if s[i] == '(':
				if b == 0:
					u = i + 1
				b += 1
			elif s[i] == ')':
				b -= 1
				if b == 0:
					argu.append(cao(s[u: i]))
			elif b == 1:
				if s[i] == ',':
					argu.append(cao(s[u: i]))
					u = i + 1
		print s[pos+1], obj,
		for i in argu:
			print i,
		print
		lines += 1
		return lines

	first = cao(s[:pos])
	second = cao(s[pos + 1:])
	print sym, first, second
	lines += 1
	return lines
cao(s)